{extend name="web/public/base" /}
{block name="header"}
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li class="active">{$title}</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <section class="panel panel-default">
                <header class="panel-heading"> {$title}</header>
                <!--<div class="btn-toolbar" style="margin:5px 0 5px 10px">-->
                <!--<a type="button" class="btn btn-primary" href="{:url('one')}">新 增</a>-->
                <!--</div>-->
                {include file="web/public/search" /}
                {notempty name="_list"}
                <div class="table-responsive">
                    <table class="table table-striped table-hover b-t b-light text-sm">
                        <thead>
                        <tr>
                            <th width="80px">ID号</th>
                            <th>订单号</th>
                            <th>(会员)出/入</th>
                            <th>市商名称</th>
                            <th>价格</th>
                            <th>数量</th>
                            <th>总价</th>
                            <th>用户账号</th>
                            <th>支付方式</th>
                            <th>支付截图</th>
                            <th>创建时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name='_list' id='vo'}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.order_number}</td>
                            <td>{if $vo['recordtype'] == 1}买入{else/}售出{/if}</td>
                            <td>{$vo.trader_name}</td>
                            <td>{$vo.price}</td>
                            <td>{$vo.num}</td>
                            <td>{$vo.total}</td>
                            <td>{$vo.usernumber}</td>
                            <td>{$vo.paytype_name}</td>
                            <td>{if condition="$vo['icon']"}
                                <img src="{$vo.icon}" onclick="showImg(this);return false;"
                                     style="width: 50px;height: 50px">
                                {else/}
                                暂无
                                {/if}
                            </td>
                            <td>{$vo.create_time}</td>
                            <td>{$vo.status_name}</td>
                            <td>
                                {if $vo['status'] == 15}
                                <a title="完成订单" href="javascript:;" onclick="handle({$vo.id},'agree');return false;"
                                   class="btn btn-success">完成订单</a>
                                <a title="取消订单" href="javascript:;" onclick="handle({$vo.id},'refuse');return false;"
                                   class="btn btn-success">取消订单</a>
                                {else/}无{/if}
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                    {$page}
                </div>
                {else/}
                <div style="text-align: center">
                    <image src="__PUBLIC__/images/empty.jpg"></image>
                </div>
                {/notempty}
            </section>
        </div>
    </div>
</section>
{/block}
{block name="script"}
<script type="text/javascript">

    function handle(id, type) {
        $.post('/admin/Traders_orders/handleOrder', {id: id, type: type}, function (data) {
            layer.msg(data.msg);
            if (data.status) {
                setTimeout(function () {
                    layer.closeAll();
                    window.location.reload()
                }, 2000);
            }
        }, 'json')
    }

    function showImg(obj) {
        var src = $(obj).attr('src');

        //页面层
        layer.open({
            type: 1,
            skin: 'layui-layer-rim', //加上边框
            area: ['60%', '90%'], //宽高
            shadeClose: true, //开启遮罩关闭
            end: function (index, layero) {
                return false;
            },
            content: '<div style="text-align:center;height:100%"><img style="max-height: 100%" src="' + src + '" /></div>'
        });
    }
</script>
{/block}

